home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / text / hyper / ADtoHT2_0.lha / AVL.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-15  |  750 b   |  33 lines

  1. #ifndef AVL_H
  2. #define AVL_H
  3.  
  4. struct AVLNode            /* Do not touch */
  5.   {
  6.     struct AVLNode *Left, *Right;
  7.     struct AVLNode *Parent;
  8.     int Balance;
  9.   };
  10.  
  11. struct AVLTree
  12.   {
  13.     struct AVLNode *Root;
  14.     int (*CompareNodes) (struct AVLNode *, struct AVLNode *);    /* see strcmp() */
  15.   };
  16.  
  17. struct AVLStateInfo
  18.   {
  19.     struct AVLNode *CurrentNode;
  20.     struct AVLNode *FromNode;
  21.     int GoRight;
  22.   };
  23.  
  24. /************************************************************************/
  25.  
  26. struct AVLNode *AVL_InsertNode (struct AVLTree *, struct AVLNode *);
  27. struct AVLNode *AVL_SearchNode (struct AVLTree *, struct AVLNode *);
  28.  
  29. void AVL_InitTraversal (struct AVLTree *, struct AVLStateInfo *);
  30. struct AVLNode *AVL_InOrder (struct AVLStateInfo *);
  31.  
  32. #endif /* AVL_H */
  33.